</head>
<body>
<!-- new feed --> 
	<div data-role="page" id="pagenewfeed">
		<div data-role="panel" id="sidePanel" data-display="revealPanel" data-position-fixed="true" style="background-color:#C0C0C0;">
			<ul data-role="listview">
				<li data-icon="back"><a href="#pagenewfeed" data-rel="close">Close</a></li>
				<li data-icon="lock"><a href="<? echo base_url(); ?>home/logout">Log out</a></li>
			</ul>
			<br>

  			<form class="ui-filterable">
				<input id="myFilter" data-type="search" placeholder="Search friend ..">
			</form>

			<ul data-role="listview" data-filter="true" data-input="#myFilter" data-filter-reveal="true" data-inset="true">
			<? for( $i = 0; $i < count($all_user); $i++ ) : ?>
			<li><? echo $all_user[$i]['fb_username']; ?></li>
			<? endfor; ?>
			<li>taxt5</li>
			</ul>
		</div>
		
		<div data-role="header" data-position="fixed" style="background-color:#6495ed;">
			<a href="#sidePanel" class="ui-btn ui-icon-bars ui-btn-icon-notext ui-nodisc-icon ui-alt-icon ui-shadow ui-btn-left"></a>
			<h1>FACEBOOK</h1>
			<div class="ui-btn-right" data-role="controlgroup" data-type="horizontal">
				<a href="#pagewall">
				<img src="<? echo base_url() . $fb['0']['fb_pic']; ?>" style="width:35px;height:35px;">
				</a>
			</div>
		</div>
		
		<div class="ui-panel-wrapper" id="mainwrapper">
			<div data-role="main" class="ui-content">

	<!--- Post box -->
				<div class="ui-grid-solo" id="post_grid">
					<div class="ui-block-a ui-shadow">
						<div class="ui-body ui-body-a ui-corner-all" id="post_box">
							<fieldset>
								<button class="ui-btn ui-mini ui-btn-inline ui-btn-icon-left ui-icon-comment">status</button>
								<button class="ui-btn ui-mini ui-btn-inline ui-btn-icon-left ui-icon-camera">add photo</button>
							</fieldset>
							<form>
								<textarea data-role="none" name="textarea-1" rows="2" id="text_box0" class="areatext ui-input-text ui-shadow-inset ui-body-inherit ui-corner-all "  placeholder="What's on your mind .."></textarea>
							</form>
							<div class="ui-grid-solo">
								<div class="ui-block-a"><a href="#" class="ui-btn" style="background-color:#6495ed" id="postButton" onclick="postButton_click(0)">Post</a></div>
							</div>
						</div>
					</div>
					<br>
				</div>
	<!--- end Post box -->

	<!--- feed box --> 
				<div class="ui-grid-solo" id="feed_grid0">
					<? for ( $i = 0; $i < count($post_newfeed); $i++ ): ?>
					<div class="ui-block-a item<?php echo $i;?> " id="<? echo $post_newfeed[$i]['post_id']; ?>" style='display:none'>
						<div class="ui-body ui-body-a">
							<div class="ui-block-a">
								<div class="ui-bar" style="height:60px;width:50px">
									<img src="<? echo base_url() . $post_newfeed[$i]['fb_pic_poster']; ?>" style="width:50px;height:50px;">
								</div>
							</div>
							<div class="ui-grid-solo">
								<div class="ui-bar" style="height:60px">
									<div id="post_name" style="margin-top:5px">
										<? if ( $post_newfeed[$i]['fb_id_poster'] != $post_newfeed[$i]['fb_id_wall'] ) : ?>
										<h1>
										<? echo $post_newfeed[$i]['fb_username_poster']; ?> > <? echo $post_newfeed[$i]['fb_username_wall']; ?>
										</h1>
										<? elseif ( $post_newfeed[$i]['fb_id_poster'] == $post_newfeed[$i]['fb_id_wall'] ) : ?>
										<h1>
										<? echo $post_newfeed[$i]['fb_username_poster']; ?>	
										</h1>
										<? endif; ?>
									</div>
									<div id="post_time" style="margin-top:5px"><? echo $post_newfeed[$i]['post_timestamp']; ?></div>
								</div>
							</div>
						</div>

						<div class="ui-body ui-body-a ui-coner-all">
							<p><? echo $post_newfeed[$i]['post_content']; ?></p>
							<? if ( $post_newfeed[$i]['post_pic'] != null) : ?>
								<img src="<? echo base_url() . $post_newfeed[$i]['post_pic']; ?>" style="width:100%; height:120%;">
							<? endif; ?>
						</div>
						<div class="ui-bar ui-bar-a">
							<div class="ui-grid-a ">
								<? if ( $post_newfeed[$i]['total_like'] == 0 ) : ?>
									<div><p class="total_like_<? echo $post_newfeed[$i]['post_id']; ?>">Be the first to like this.</p></div>
								<? elseif ( $post_newfeed[$i]['total_like'] > 0 && $post_newfeed[$i]['total_like'] != 1 && $post_newfeed[$i]['liked'] == 'TRUE'): ?>
									<div><p class="total_like_<? echo $post_newfeed[$i]['post_id']; ?>">You and <? echo $post_newfeed[$i]['total_like'] - 1; ?> people like this.</p></div>
								<? elseif ( $post_newfeed[$i]['total_like'] > 0 && $post_newfeed[$i]['liked'] == 'FALSE'): ?>
					
									<div><p class="total_like_<? echo $post_newfeed[$i]['post_id']; ?>"><? echo $post_newfeed[$i]['total_like']; ?> people like this.</p></div>
								<? elseif ( $post_newfeed[$i]['total_like'] == 1 && $post_newfeed[$i]['liked'] == 'TRUE'): ?>
					
									<div><p class="total_like_<? echo $post_newfeed[$i]['post_id']; ?>">You like this.</p></div>
								<? endif; ?>
								<div style="border:1px solid gray" ></div><p>
								<? if ( $post_newfeed[$i]['liked'] == 'FALSE'  && $post_newfeed[$i]['total_like'] > 0 ) : ?>
									<div class="ui-block-a"><a href="#" class="like_button_<? echo $post_newfeed[$i]['post_id']; ?> ui-btn" onclick="checkClick(<? echo $post_newfeed[$i]['post_id']; ?>, 1, <? echo $post_newfeed[$i]['total_like']; ?>)">Like</a></div>
								<? elseif ( $post_newfeed[$i]['liked'] == 'FALSE' && $post_newfeed[$i]['total_like'] == 0) : ?>
									<div class="ui-block-a"><a href="#" class="like_button_<? echo $post_newfeed[$i]['post_id']; ?> ui-btn" onclick="checkClick(<? echo $post_newfeed[$i]['post_id']; ?>, 0, <? echo $post_newfeed[$i]['total_like']; ?>)">Like</a></div>
								<? elseif ( $post_newfeed[$i]['liked'] == 'TRUE'  && $post_newfeed[$i]['total_like'] == 0 ): ?>
									<div class="ui-block-a"><a href="#" class="like_button_<? echo $post_newfeed[$i]['post_id']; ?> ui-btn" onclick="checkClick(<? echo $post_newfeed[$i]['post_id']; ?>, 0, <? echo $post_newfeed[$i]['total_like']; ?>)">Unlike</a></div>
								<? elseif ( $post_newfeed[$i]['liked'] == 'TRUE'  && $post_newfeed[$i]['total_like'] > 0 ): ?>
									<div class="ui-block-a"><a href="#" class="like_button_<? echo $post_newfeed[$i]['post_id']; ?> ui-btn" onclick="checkClick(<? echo $post_newfeed[$i]['post_id']; ?>, 1, <? echo $post_newfeed[$i]['total_like']; ?>)">Unlike</a></div>
								<? endif; ?>
								<div class="ui-block-b"><a  class="ui-btn"  onclick="load_content(<? echo $post_newfeed[$i]['post_id']; ?>)">Comment</a></div>
							</div>
						</div>
						<br>
						<br>
					</div>
					
					<? endfor; ?>
				</div>
			</div>
		</div>
<!-- feed box -->

		<div data-role="footer" data-position="fixed">
			<div data-role="navbar">
				<ul>
					<li><a href="#pagenewfeed" data-icon="home" class="ui-btn-active ui-state-persist">New Feed</a></li>
					<li><a href="#pagewall" data-icon="user">Wall</a></li>
				</ul>
			</div>
		</div>
	</div>	
<!-- end newfeed -->
	
<!--  Page wall --> 
<div data-role="page" id="pagewall">
  <div data-role="panel" id="myPanel" data-display="push" data-position="left" style="background-color:#C0C0C0;"> 
			<ul data-role="listview">
				<li data-icon="back"><a href="#newfeed" data-rel="close">Close</a></li>
				<li data-icon="lock"><a href="<? echo base_url(); ?>home/logout">Log out</a></li>
			</ul>
			<br>
  	<form class="ui-filterable">
      <input id="myFilter" data-type="search" placeholder="Search friend ..">
    </form>
    <ul data-role="listview" data-filter="true" data-input="#myFilter" data-filter-reveal="true" data-inset="true">
				<li></li>
				<?php 
					for($i=0;$i<sizeof($all_user);$i++){
						echo "<li>".$all_user[$i]['fb_name']."</li>";
					}
				?>
	</ul>
  </div> 
  <div data-role="header" style="background-color:#6495ed; " data-position="fixed">
			<a href="#myPanel" class="ui-btn ui-icon-bars ui-btn-icon-notext ui-nodisc-icon ui-alt-icon ui-shadow ui-btn-left"></a>
    <h1>FACEBOOK</h1>
  </div>
  <div class="ui-panel-wrapper" id="a">
  	<div data-role="main" class="ui-content " >
		<div class="ui-grid-solo">
		  	<div class="ui-block-a">
		  		<!-- <div class="ui-grid-a"> -->
				    <div class="ui-block-a">
				    	<div class="ui-bar" style="height:90px;width:90px">
				    		<img src="<?php echo base_url().$fb[0]['fb_pic']; ?>" style="width:90px;height:90px;">
				    	</div>
				    </div>
				    <div class="ui-grid-solo">
				    	<div class="ui-bar" style="height:100px">
				    		<div id="profile_name" style="margin-top:30px"><h1><?php echo $fb[0]['fb_username'];?></h1></div>
				    	</div>
				    </div>
				<!-- </div> -->
		  	</div>
      		<div class="ui-block-a" >
      			<form>
    				<textarea data-role="none" name="textarea-1" rows="5" id="text_box1" class="areatext ui-input-text ui-shadow-inset ui-body-inherit ui-corner-all "  placeholder="What's on your mind .."></textarea>
    				<div class="ui-grid-a ">
					    <div class="ui-block-a"><a class="ui-btn ui-shadow ui-corner-all" onclick="postButton_click(1)">Post</a></div>
					    <div class="ui-block-b"><a class="ui-btn ui-shadow ui-corner-all" onclick="clear_text()">Refesh</a></div>
					</div>
				</form>
      		</div>
		<div class="ui-grid-solo" id="feed_grid1">
      		<?php for($i=0;$i<sizeof($post_wall);$i++){ ?>
      		<div class="ui-block-a item<?php echo $i; ?>" id="<? echo $post_wall[$i]['post_id']; ?>" style="display:none;">
      			<div class="ui-body ui-body-a">
      				<div class="ui-block-a">
				    	<div class="ui-bar" style="height:60px;width:50px">
				    		<img src='<?php echo base_url().$post_wall[$i]['fb_pic_poster'] ?>' style="width:50px;height:50px;">
				    	</div>
				    </div>
				    <div class="ui-grid-solo">
				    	<div class="ui-bar" style="height:60px">
				    		<div id="post_name" style="margin-top:5px"><h1><?php echo $post_wall[$i]['fb_username_poster']."  > ".$post_wall[$i]['fb_username_wall']; ?></h1></div>
				    		<div id="post_time" style="margin-top:5px"><?php echo $post_wall[$i]['post_timestamp']; ?></div>
				    	</div>
				    </div>
				</div>
				<div class="ui-body ui-body-a ui-coner-all">
						<?php 
							if($post_wall[$i]['post_content']!=null){
							 	echo "<p>".$post_wall[$i]['post_content']."</p>";
							}
							if($post_wall[$i]['post_pic']!=null){
								echo "<div id='imgcontent'>";
								echo "<img src='".base_url().$post_wall[$i]['post_pic']."' style='width:100%'>";
								echo "</div>";
							}
						?>
				</div>
				<div class="ui-bar ui-bar-a">
    				<div class="ui-grid-a ">
								<? if ( $post_wall[$i]['total_like'] == 0 ) : ?>
									<div><p class="total_like_<? echo $post_wall[$i]['post_id']; ?>">Be the first to like this.</p></div>
								<? elseif ( $post_wall[$i]['total_like'] > 0 && $post_wall[$i]['total_like'] != 1 && $post_wall[$i]['liked'] == 'TRUE'): ?>
									<div><p class="total_like_<? echo $post_wall[$i]['post_id']; ?>">You and <? echo $post_wall[$i]['total_like'] - 1; ?> people like this.</p></div>
								<? elseif ( $post_wall[$i]['total_like'] > 0 && $post_wall[$i]['liked'] == 'FALSE'): ?>
					
									<div><p class="total_like_<? echo $post_wall[$i]['post_id']; ?>"><? echo $post_wall[$i]['total_like']; ?> people like this.</p></div>
								<? elseif ( $post_wall[$i]['total_like'] == 1 && $post_wall[$i]['liked'] == 'TRUE'): ?>
					
									<div><p class="total_like_<? echo $post_wall[$i]['post_id']; ?>">You like this.</p></div>
								<? endif; ?>
						 <div style="border:1px solid gray" ></div><p>
								<? if ( $post_wall[$i]['liked'] == 'FALSE'  && $post_wall[$i]['total_like'] > 0 ) : ?>
									<div class="ui-block-a"><a href="#" class="like_button_<? echo $post_wall[$i]['post_id']; ?> ui-btn" onclick="checkClick(<? echo $post_wall[$i]['post_id']; ?>, 1, <? echo $post_wall[$i]['total_like']; ?>)">Like</a></div>
								<? elseif ( $post_wall[$i]['liked'] == 'FALSE' && $post_wall[$i]['total_like'] == 0) : ?>
									<div class="ui-block-a"><a href="#" class="like_button_<? echo $post_wall[$i]['post_id']; ?> ui-btn" onclick="checkClick(<? echo $post_wall[$i]['post_id']; ?>, 0, <? echo $post_wall[$i]['total_like']; ?>)">Like</a></div>
								<? elseif ( $post_wall[$i]['liked'] == 'TRUE'  && $post_wall[$i]['total_like'] == 0 ): ?>
									<div class="ui-block-a"><a href="#" class="like_button_<? echo $post_wall[$i]['post_id']; ?> ui-btn" onclick="checkClick(<? echo $post_wall[$i]['post_id']; ?>, 0, <? echo $post_wall[$i]['total_like']; ?>)">Unlike</a></div>
								<? elseif ( $post_wall[$i]['liked'] == 'TRUE'  && $post_wall[$i]['total_like'] > 0 ): ?>
									<div class="ui-block-a"><a href="#" class="like_button_<? echo $post_wall[$i]['post_id']; ?> ui-btn" onclick="checkClick(<? echo $post_wall[$i]['post_id']; ?>, 1, <? echo $post_wall[$i]['total_like']; ?>)">Unlike</a></div>
								<? endif; ?>
								<div class="ui-block-b"><a   class="ui-btn" id="comment_btn" onclick='load_content(<?php echo $post_wall[$i]['post_id'];?>)'>Comment</a></div>
					</div>
				</div>
      		</div>
		<br>
		<br>
      		<?php } ?>
		</div>
		</div>
  	</div>
  </div>

  <div data-role="footer" data-position="fixed" >
  	<div data-role="navbar">
				<ul>
					<li><a href="#pagenewfeed" data-icon="home" >New Feed</a>
					<li><a href="#pagewall" data-icon="user" class="ui-btn-active ui-state-persist">Wall</a>
				</ul>
			</div>
  </div>
</div>
 <!-- endwall -->

<!-- pagecomment -->

<div data-role="page" id="pagecomment">
  <input type="hidden" id="num_comment" value=''/> 
  <div data-role="header" style="background-color:#6495ed; " data-position="fixed">
  	<button class="ui-btn ui-corner-all ui-icon-bars ui-btn-icon-notext" id="friend"></button>
    <h1>FACEBOOK</h1>
  </div>
  	<div data-role="main" class="ui-content" id="show_content">
  		
      	</div>


  <div data-role="footer" data-position="fixed" >
  	<div data-role="navbar">
				<ul>
					<li><a href="#pagenewfeed" data-icon="home" >New Feed</a>
					<li><a href="#pagewall" data-icon="user" class="ui-btn-active ui-state-persist">Wall</a>
				</ul>
			</div>
  </div>
</div>
<!-- endcomment -->

